import Taro, { Component } from '@tarojs/taro'
import { View, Image } from '@tarojs/components'
import './index.scss'
import classNames from 'classnames'
import { toGoodsPage } from '@/utils/page_router'

interface IProps {
  info: any
  className?: string
}

export default class GoodsFourItem extends Component<IProps, {}> {
  props: any

  static options = {
    addGlobalClass: true
  }

  render() {
    const { info={}, className } = this.props
    return (<View className={classNames('goods-four-item', className)} onClick={() => toGoodsPage(info)}>
      <View className='goods-img'>
        <Image src={info.coverImg}/>
      </View>
      <View className='goods-box d-f f-d-c j-c-b'>
        <View className='goods-name t-o-e-2'>{info.name}</View>
        <View className='goods-price d-f a-i-b'>
          <View className='sale-price bnn-number'>￥{info.salePrice}</View>
          {info.originPrice > info.salePrice && <View className='origin-price bnn-number'>￥{info.originPrice}</View>}
        </View>
      </View>
    </View>)
  }
}
